﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;

namespace DemoHangFire.Controllers;


[ApiController]
[Route("api/[controller]")]
public class TestController: ControllerBase
{

    private IHttpContextAccessor _httpContextAccessor;

    public TestController(IHttpContextAccessor _httpContextAccessor)
    {
          this._httpContextAccessor=_httpContextAccessor;
    }
    
    [HttpGet]
    public async Task<string> GetIp()
    {
        return _httpContextAccessor.HttpContext.Request.Host.Value;
    }
}